#include<stdio.h>
#include<stdlib.h>


void merge(int* nums1, int m, int* nums2, int n){
	int i = 0, j = 0;
	if (nums2 == NULL)
	{
		return;
	}
	while (nums1[i] && nums2[j]>0)
	{
		if ((nums1[i]<nums2[j]))
		{
			i++;
		}
		else
		{
			for (int k = m - 1; k>i; k--)
			{
				nums1[k] = nums1[k - 1];
			}
			nums1[i++] = nums2[j++];
		}
	}
	while (j<n)
	{
		nums1[i++] = nums2[j++];
	}
}


int main()
{
	int arr1[] = { 2, 0 };
	int arr2[] = { 1 };
	int sz1 = sizeof(arr1) / sizeof(arr1[0]);
	int sz2 = sizeof(arr2) / sizeof(arr2[0]);
	merge(arr1, sz1, arr2, sz2);
	for (int i = 0; i < sz1; i++)
	{
		printf("%d ", arr1[i]);
	}
	system("pause");
	return 0;
}